<template>
	<view>
		<cu-custom :bgImage="bgImg" :isBack="false">
			<view slot="content">首页</view>
		</cu-custom>
		<view class="margin-left margin-right margin-top-sm">
			<u-swiper :list="swiperList"></u-swiper>
		</view>
		<view class="margin flex" style="height: 300rpx;">
			<view class="flex flex-direction align-center justify-center radius bg-cyan light" style="width: 50%; height: 300rpx;" @click="goToPhont(1)">
				<view class="text-lg text-bold">动物识别</view>
				<view class="muted text-sm">上传图片识别动物类别</view>
			</view>
			<view class="margin-left-sm flex flex-direction justify-between" style="width: 50%;">
				<view class="flex align-center justify-center radius bg-green light" style="height: 130rpx;" @click="goToPhont(2)">
					<view class="text-lg text-bold">动物诊疗</view>
				</view>
				<view class="flex flex-direction align-center justify-center radius bg-yellow light" style="height: 130rpx;" @click="goToInvite">
					<view class="text-lg text-bold">邀请好友</view>
					<view class="muted text-sm">分享获取积分</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { mapGetters, mapActions } from 'vuex'
	
	export default {
		data() {
			return {
				photo: '',
				customStyle: {
					color: '#fbbd08'
				},
				bgImg: 'https://jiaoguanyi008.oss-cn-shenzhen.aliyuncs.com/miniPro/images/imgs/customBg.jpg',
				swiperList: [
					{
						image: "https://jiaoguanyi008.oss-cn-shenzhen.aliyuncs.com/miniPro/images/imgs/banner3.png",
					},
					{
						image: "https://jiaoguanyi008.oss-cn-shenzhen.aliyuncs.com/miniPro/images/imgs/banner2.png"
					}
					
				],
			}
		},
		async onLoad(options) {
			this.getUser()
			console.log("这是userInfo", this.userInfo)
		},
		onShow() {},
		onShareAppMessage() {
			return {
				title: '识别宠物病症',
				path: '/pages/index/index'
			}
		},
		methods: {
			...mapActions(['getUser']),
			goToPhont(type) {
				uni.navigateTo({
					url: '/pages_subpackage/takePhoto/takePhoto?type=' + type
				})

			},
			goToUrl() {
				let item = {
					_id: 0,
					uploadRes: 'https://jiaoguanyi008.oss-cn-shenzhen.aliyuncs.com/photo/2023-12/%E7%8C%AB.jpg'
				}
				uni.navigateTo({
					url: '/pages_subpackage/result/result?item=' + encodeURIComponent(JSON.stringify(item))
				})
				uni.navigateTo({
					url: '/pages_subpackage/result/result'
				})
			},
			goToInvite() {
				uni.navigateTo({
					url: '/pages_subpackage/invite/invite'
				})
			}

		},
		computed: {
			...mapGetters(['userInfo', 'isLogin'])
		}
	}
</script>

<style>
	.background {
		/* background-image: url('https://jiaoguanyi008.oss-cn-shenzhen.aliyuncs.com/miniPro/images/imgs/cat%20(2).gif'); */
		/* 替换为你的图片路径 */
		background-size: cover;
		/* 背景图片覆盖整个容器 */
		background-position: center;
		/* 图片居中 */
		background-repeat: no-repeat;
		/* 不重复图片 */
		height: 100%;
		/* 高度设置为100%，使其覆盖整个视口 */
		width: 100%;
		/* 宽度设置为100%，使其覆盖整个视口 */
		position: fixed;
		/* 背景固定，内容可以在其上层显示 */
	}

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		margin-top: 100rpx;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}
</style>